#include<cstdio>
#include<cstring>
#define N 1000010
int a[N],b[N],p[N],last[N],n,T;
char ans[N];
bool check(int l1,int r1,int l2,int r2,int mid,int op,int t=1)
{
	while (l1<mid || r2>mid)
	{
		if (t>=n)
		{
			if (l1<mid && a[l1]==b[2*n-t])
				b[++t]=a[l1++],ans[t]='L';
			else if (r2>mid && a[r2]==b[2*n-t])
				b[++t]=a[r2--],ans[t]='R';
			else return 0;
			continue;
		}
		if (l1<=r1)
		{
			if (p[l1]==r1 && l1<=r1)
			{
				b[++t]=a[l1++],--r1,ans[t]='L';
				continue;
			}
			else if (p[l1]==l2 && l2<=r2)
			{
				b[++t]=a[l1++],++l2,ans[t]='L';
				continue;
			}
		}
		if (l2<=r2)
		{
			if (p[r2]==r1 && l1<=r1)
			{
				b[++t]=a[r2--],--r1,ans[t]='R';
				continue;
			}
			else if (p[r2]==l2 && l2<=r2)
			{
				b[++t]=a[r2--],++l2,ans[t]='R';
				continue;
			}
		}
		return 0;
	}
	ans[1]=op?'R':'L';
	for (int i=1;i<2*n;++i) putchar(ans[i]);
	puts("L");
	return 1;
}
int main()
{
	freopen("palin.in","r",stdin);
	freopen("palin.out","w",stdout);
	for (scanf("%d",&T);T--;)
	{
		scanf("%d",&n);
		for (int i=1;i<=2*n;++i) 
			scanf("%d",&a[i]);
		for (int i=1;i<=n;++i) last[i]=0;
		for (int i=1;i<=2*n;++i)
			p[i]=last[a[i]],last[a[i]]=i;
		for (int i=2*n;i>=1;--i)
			(last[a[i]]^i) && (p[i]=last[a[i]],1),last[a[i]]=i;
		if (!check(2,p[1]-1,p[1]+1,2*n,p[1],0))
			if (!check(1,p[2*n]-1,p[2*n]+1,2*n-1,p[2*n],1))
				puts("-1");
	}
	return 0;
}
